package com.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.bean.ChaXunBean;

import java.util.List;

import demo.zdc.com.myapplication.R;

/**
 * Created by de on 2017/2/24.
 */

public class ChaXunAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{

    private List<ChaXunBean.Search_result> date;
    private Context context;
        public ChaXunAdapter(Context context, List<ChaXunBean.Search_result> date){
        this.context = context;
        this.date= date;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(parent.getContext(), R.layout.item_appraisal_viewpager, null);
        return new CommomHoler(view);
    }


    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) {
        ((CommomHoler)holder).name.setText(date.get(position).getExhibition());
        ((CommomHoler)holder).date.setText("日期："+date.get(position).getClearing_date());
        ((CommomHoler)holder).num.setText("售出数量："+date.get(position).getTicketNum()+"");
    }

    @Override
    public int getItemCount() {
        return date.size();
    }


    class CommomHoler extends  RecyclerView.ViewHolder{
        TextView name,date,num;

        public CommomHoler(View itemView) {
            super(itemView);
            name = (TextView)itemView.findViewById(R.id.name);
            date =(TextView)itemView.findViewById(R.id.date);
            num = (TextView)itemView.findViewById(R.id.num);
        }
    }
}